<?php
if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );

class friendsreferral extends MY_Controller {
	function __construct() {
		parent::__construct ();
		$this->load->helper ( 'url' );
		$this->load->model ( 'friendsreferral_model' );
	}
	/**
	 * 显示 推荐好友 主页 
	 * Enter description here ...
	 */
	function index() {
		$this->load->view ( 'headers/header01' );
		$this->load->view ( "referral/inside_hytj" );
		$this->load->view ( "footers/footer01" );
	}
	function getFridensList() {
		//$data=$_POST;
		$item ['userId'] = 2;
		$array = $this->friendsreferral_model->queryFriendsList ( $_POST );
		log_message ( "info", '好友信息==〉' . json_encode ( $array ) );
		echo json_encode ( $array );
	}
	function addFriends() {
		echo $this->load->friendsreferral_model->addReferral ( $_POST );
	}
	function addFriend() {
		$data='系统繁忙请稍后再试';
		if ($this->checkUser ( $_GET ['userId'] )) {
			$data = '您已经申请成功';
			$isReferral = $this->friendsreferral_model->isReferral ( $_GET );
			if (empty ( $isReferral )) {
				$data = '申请成功';
				$_GET ['createTime'] = date ( 'Y-m-d H:i:s' );
				$this->friendsreferral_model->addFriendsreferral ( $_GET );
			}
			
		}
		echo $data;
	}
	function userDynamic() {
		$this->load->view ( 'public_view/user_dynamic' );
	}
	function userLeft() {
		$this->load->view ( 'public_view/user_left' );
	}
	
}
?>